﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:res="clr-namespace:FunPad;assembly=FunPad.XamlResource"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:extToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended, Version=1.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4">
            
    <Style x:Key="ChromeWindowStyle" TargetType="{x:Type Window}" >
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="MinHeight" Value="393.75"/>
        <Setter Property="MinWidth" Value="525"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Grid>
                        <Border BorderThickness="1" CornerRadius="6" BorderBrush="#44587C" Background="#FCFCFC">
                            <ContentPresenter Margin="10" Content="{TemplateBinding Content}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="MenuItem">        
        <Setter Property="FontSize" Value="12"/>
    </Style>
    
   <Style TargetType="ContextMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" 
           xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
        
        <Setter Property="Panel.Background">
            <Setter.Value>
                <SolidColorBrush>#FFF5F5F5</SolidColorBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.FontFamily">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemFonts.MenuFontFamilyKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.FontSize">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemFonts.MenuFontSizeKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.FontStyle">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemFonts.MenuFontStyleKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.FontWeight">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemFonts.MenuFontWeightKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.Foreground">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemColors.MenuTextBrushKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="Control.VerticalContentAlignment">
            <Setter.Value>
                <x:Static Member="VerticalAlignment.Center" />
            </Setter.Value>
        </Setter>
        <Setter Property="Border.CornerRadius" Value="5"/>            
       
        <Setter Property="Border.BorderThickness" Value="1"/>
        
        <Setter Property="Border.BorderBrush">
            <Setter.Value>
                <SolidColorBrush>#44587C</SolidColorBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Control.Padding">
            <Setter.Value>
                <Thickness>2,2,2,2</Thickness>
            </Setter.Value>
        </Setter>
        <Setter Property="Grid.IsSharedSizeScope">
            <Setter.Value>
                <s:Boolean>True</s:Boolean>
            </Setter.Value>
        </Setter>
        <Setter Property="ContextMenuService.HasDropShadow">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemParameters.DropShadowKey}" />
            </Setter.Value>
        </Setter>
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContextMenu">
                    <mwt:SystemDropShadowChrome Color="#00FFFFFF" Name="Shdw" SnapsToDevicePixels="True">
                        <Border CornerRadius="{TemplateBinding Border.CornerRadius}" BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}">
                            <Grid>
                                <Rectangle RadiusX="2" RadiusY="2" Fill="#FFF1F1F1" Width="28" Margin="2,2,2,2" HorizontalAlignment="Left" />
                                <Rectangle Fill="#FFE2E3E3" Width="1" Margin="30,2,0,2" HorizontalAlignment="Left" />
                                <Rectangle Fill="#FFFFFFFF" Width="1" Margin="31,2,0,2" HorizontalAlignment="Left" />
                                <ScrollViewer CanContentScroll="True" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=FrameworkElement, ResourceId=MenuScrollViewer}}" Margin="1,0,1,0" Grid.ColumnSpan="2">
                                    <ItemsPresenter Margin="{TemplateBinding Control.Padding}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Cycle" />
                                </ScrollViewer>
                            </Grid>
                        </Border>
                    </mwt:SystemDropShadowChrome>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ContextMenuService.HasDropShadow">
                            <Setter Property="FrameworkElement.Margin" TargetName="Shdw">
                                <Setter.Value>
                                    <Thickness>0,0,5,5</Thickness>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="mwt:SystemDropShadowChrome.Color" TargetName="Shdw">
                                <Setter.Value>
                                    <Color>#71000000</Color>
                                </Setter.Value>
                            </Setter>
                            <Trigger.Value>
                                <s:Boolean>True</s:Boolean>
                            </Trigger.Value>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="AppTitleStyle" TargetType="{x:Type TextBlock}">
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="Segoe UI, Microsoft Sans Serif, Tahoma, Arial"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="#FF767676" />
    </Style>

    <Style x:Key="ToolbarButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
        <Setter Property="Height" Value="24"/>
        <Setter Property="Width" Value="24"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="Margin" Value="5,0,5,0"/>
    </Style>

    <Style TargetType="{x:Type extToolkit:SplitButton}" >
        <Setter Property="Height" Value="25"/>
        <Setter Property="Width" Value="40"/>
        <Setter Property="Margin" Value="0,10,10,0"/>        
    </Style>

    <Style  TargetType="{x:Type Separator}" BasedOn="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>

    <Style x:Key="DisabledButtonImageStyle" TargetType="{x:Type Image}">        
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}}, Path=IsEnabled}" Value="False">
                <Setter Property="Image.Effect">
                    <Setter.Value>
                        <res:GrayScaleEffect DesaturationFactor="0.1"/>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="DisabledMenuItemImageStyle" TargetType="{x:Type Image}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=IsEnabled}" Value="False">
                <Setter Property="Image.Effect">
                    <Setter.Value>
                        <res:GrayScaleEffect DesaturationFactor="0.1"/>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="BorderThickness" Value="0.5"/>
        <Setter Property="BorderBrush" Value="#44587C"/>
    </Style>

    <RadialGradientBrush x:Key= "PressedCaptionButtonBrush" RadiusY="0.87" RadiusX="0.87">
        <GradientStop Color="#FFF3F3F3" Offset="0"/>
        <GradientStop Color="#FFA4BFEF" Offset="0.029"/>
        <GradientStop Color="#FFDBDFE7"/>
        <GradientStop Color="#FF83A3D6" Offset="1"/>
    </RadialGradientBrush>

    <RadialGradientBrush x:Key= "CloseCaptionButtonHoverBrush" RadiusY="0.87" RadiusX="0.87">
        <GradientStop Color="#FFF3F3F3" Offset="0"/>
        <GradientStop Color="#FFE8A4EF" Offset="0.029"/>
        <GradientStop Color="#FFE70438"/>
        <GradientStop Color="#FFE91230" Offset="1"/>
    </RadialGradientBrush>

    <sys:String x:Key="MaximizeKey">Maximize</sys:String>
    <sys:String x:Key="RestoreKey">Restore</sys:String>
    

    <res:WindowStateToVisibilityConverter x:Key="WindowStateToVisibilityConverter"/>
    <res:CommandToTooltipTextConverter x:Key="CommandToTooltipTextConverter"/>
    <res:WindowStateToCaptionButtonTooltipConverter x:Key="WindowStateToCaptionTooltipConverter"/>

    <Style x:Key="MinimizeCaptionButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="MainBorder" CornerRadius="4" BorderThickness="1.5" BorderBrush="Transparent" Background="GhostWhite"
                                Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Rectangle Margin="6"  Stroke="#2B3B58" StrokeThickness="0.7" Fill="White" Height="4" Width="14" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="#BCC7D8" TargetName="MainBorder"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background"  TargetName="MainBorder" Value="{StaticResource PressedCaptionButtonBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MaximizeCaptionButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="MainBorder" CornerRadius="4" BorderThickness="1.5" BorderBrush="Transparent" Background="GhostWhite"
                                Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Grid>
                            <Grid x:Name="MaximizeContainer" Visibility="{Binding Path=(res:CaptionButtonExtendedProperty.OwnerWindowState), Converter={StaticResource WindowStateToVisibilityConverter}
                                    ,ConverterParameter={StaticResource MaximizeKey} , RelativeSource={RelativeSource AncestorType={x:Type Button}}, Mode=TwoWay}" >
                                <Rectangle 
                                           Margin="4"  Stroke="#2B3B58" StrokeThickness="0.7" Fill="White" Height="10" Width="12" 
                                       VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Grid>
                            <Grid x:Name="RestoreContainer" Visibility="{Binding Path=(res:CaptionButtonExtendedProperty.OwnerWindowState), Converter={StaticResource WindowStateToVisibilityConverter}
                                    ,ConverterParameter={StaticResource RestoreKey} ,RelativeSource={RelativeSource AncestorType={x:Type Button}}, Mode=TwoWay}" >
                                <Rectangle Margin="0,4,8,4"  Stroke="#2B3B58" StrokeDashCap="Round" StrokeThickness="1" Fill="White" Height="10" Width="11" 
                                       VerticalAlignment="Top" HorizontalAlignment="Right"/>
                                <Rectangle Margin="8,0,2,4"  Stroke="#2B3B58" StrokeDashCap="Round" StrokeThickness="1" Fill="White" Height="10" Width="11" 
                                       VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="#BCC7D8" TargetName="MainBorder"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background"  TargetName="MainBorder" Value="{StaticResource PressedCaptionButtonBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CloseCaptionButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="MainBorder" CornerRadius="4" BorderThickness="1.5" BorderBrush="Transparent" Background="GhostWhite"
                                Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Path Data="M240,200 L279.5,200 279.5,279.5 359.5,279.5 359.5,319.5 279.5,319.5 279.5,399.5 239.5,399.5 239.5,319.5 159.5,319.5 159.5,279.5 239.5,279.5 z" 
                                  Fill="#FFF4F4F5" Margin="2" Width="14" Height="14" Stretch="Fill" StrokeThickness="1" Stroke="#FF2B3B58" RenderTransformOrigin="0.5,0.5" 
        HorizontalAlignment="Center"  VerticalAlignment="Center" >
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="-42.032"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="Red" TargetName="MainBorder"/>
                            <Setter Property="Background" Value="{StaticResource CloseCaptionButtonHoverBrush}" TargetName="MainBorder"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--Help button style-->
    <Style x:Key="HelpButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="FontFamily" Value="Segoe UI, Microsoft Sans Serif, Tahoma, Arial"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Foreground" Value="#FB071555" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="MainBorder" BorderBrush="Transparent" BorderThickness="0" CornerRadius="0">                      
                            <ContentPresenter HorizontalAlignment="Stretch" Margin="5,0" VerticalAlignment="Center" Width="Auto" />                        
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">                            
                            <Setter Property="Background" TargetName="MainBorder" Value="#B28DBDFF"/>                            
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" TargetName="MainBorder" Value="#CDB9B9B9"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!---->

    <Style  TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="Timeline1">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="Timeline2">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                        <Border x:Name="border" Background="Silver" BorderBrush="#44587C" BorderThickness="1,1,1,1" CornerRadius="2">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.507*"/>
                                    <RowDefinition Height="0.493*"/>
                                </Grid.RowDefinitions>
                                <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="1.702" ScaleY="2.243"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-0.368" Y="-0.152"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#B28DBDFF" Offset="0"/>
                                            <GradientStop Color="#008DBDFF" Offset="1"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
                                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
                                            <GradientStop Color="#99FFFFFF" Offset="0"/>
                                            <GradientStop Color="#33FFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Opacity" TargetName="shine" Value="0.4"/>
                            <Setter Property="Background" TargetName="border" Value="#B28DBDFF"/>
                            <Setter Property="Visibility" TargetName="glow" Value="Hidden"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource Timeline1}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="Timeline2_BeginStoryboard" Storyboard="{StaticResource Timeline2}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ToolbarStyle-->
    <LinearGradientBrush x:Key="ToolBarHorizontalBackground" EndPoint="-0.329,-0.662" MappingMode="RelativeToBoundingBox" StartPoint="0.972,3.052">
        <GradientStop Color="#FFAFACAC"/>
        <GradientStop Color="#B2919191" Offset="1"/>
        <GradientStop Color="#DB979797" Offset="0.461"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ToolBarToggleButtonVerticalBackground" EndPoint="1,0" StartPoint="0,0">
        <GradientStop Color="#ECECEC" Offset="0"/>
        <GradientStop Color="#DDDDDD" Offset="0.5"/>
        <GradientStop Color="#A0A0A0" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ToolBarButtonHover" Color="CornflowerBlue"/>
    <SolidColorBrush x:Key="ToolBarGripper" Color="#C6C3C6"/>
    <Style x:Key="ToolBarVerticalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="{StaticResource ToolBarToggleButtonVerticalBackground}"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="0,0,3,3" SnapsToDevicePixels="true">
                        <Canvas HorizontalAlignment="Right" Height="6" Margin="2,7,2,2" SnapsToDevicePixels="true" VerticalAlignment="Bottom" Width="7">
                            <Path Data="M 1.5 1 L 1.5 6" Stroke="White"/>
                            <Path Data="M 0.5 0 L 0.5 5" Stroke="{TemplateBinding Foreground}"/>
                            <Path Data="M 3.5 0.5 L 7 3.5 L 4 6.5 Z" Fill="White"/>
                            <Path Data="M 3 -0.5 L 6 2.5 L 3 5.5 Z" Fill="{TemplateBinding Foreground}"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <LinearGradientBrush x:Key="ToolBarVerticalBackground" EndPoint="1,0" StartPoint="0,0">
        <GradientStop Color="#FFFFFF" Offset="0"/>
        <GradientStop Color="#FFFBFF" Offset="0.5"/>
        <GradientStop Color="#F7F7F7" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="ToolBarToggleButtonHorizontalBackground" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#ECECEC" Offset="0"/>
        <GradientStop Color="#DDDDDD" Offset="0.5"/>
        <GradientStop Color="#A0A0A0" Offset="1"/>
    </LinearGradientBrush>
    <Style x:Key="ToolBarHorizontalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="{StaticResource ToolBarToggleButtonHorizontalBackground}"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="0,3,3,0" SnapsToDevicePixels="true">
                        <Canvas HorizontalAlignment="Right" Height="7" Margin="7,2,2,2" SnapsToDevicePixels="true" VerticalAlignment="Bottom" Width="6">
                            <Path Data="M 1 1.5 L 6 1.5" Stroke="White"/>
                            <Path Data="M 0 0.5 L 5 0.5" Stroke="{TemplateBinding Foreground}"/>
                            <Path Data="M 0.5 4 L 6.5 4 L 3.5 7 Z" Fill="White"/>
                            <Path Data="M -0.5 3 L 5.5 3 L 2.5 6 Z" Fill="{TemplateBinding Foreground}"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <SolidColorBrush x:Key="ToolBarMenuBorder" Color="#808080"/>
    <SolidColorBrush x:Key="ToolBarSubMenuBackground" Color="#FDFDFD"/>
    <Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                        <Rectangle>
                            <Rectangle.Fill>
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,4,4" Viewport="0,0,4,4" ViewportUnits="Absolute" ViewboxUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <GeometryDrawing Brush="White" Geometry="M 1 1 L 1 3 L 3 3 L 3 1 z"/>
                                            <GeometryDrawing Brush="{StaticResource ToolBarGripper}" Geometry="M 0 0 L 0 2 L 2 2 L 2 0 z"/>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Cursor" Value="SizeAll"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="CornerRadius" Value="5"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="CornerRadius" Value="0,0,0,0"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="FunPadToolbarStyle" TargetType="{x:Type ToolBar}">
        <Setter Property="Background" Value="{StaticResource ToolBarHorizontalBackground}"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="ToolBarTray.IsLocked" Value="True"/>
        <Setter Property="Margin" Value="0,10,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolBar}">
                    <Grid x:Name="Grid" Margin="1,1,1,1" SnapsToDevicePixels="true">
                        <Grid x:Name="OverflowGrid" HorizontalAlignment="Right" Visibility="Collapsed">
                            <ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}"/>
                            <Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false">
                                <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
                                    <Border x:Name="ToolBarSubMenuBorder" BorderBrush="{StaticResource ToolBarMenuBorder}" BorderThickness="1" Background="{StaticResource ToolBarSubMenuBackground}" RenderOptions.ClearTypeHint="Enabled">
                                        <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/>
                                    </Border>
                                </Microsoft_Windows_Themes:SystemDropShadowChrome>
                            </Popup>
                        </Grid>
                        <Border x:Name="MainPanelBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" Style="{StaticResource ToolBarMainPanelBorderStyle}">
                            <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
                                <Thumb x:Name="ToolBarThumb" Margin="-3,-1,0,0" Padding="6,5,1,6" Style="{StaticResource ToolBarThumbStyle}" Width="10"/>
                                <ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0,4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                                <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" Margin="0,1,2,2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </DockPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsOverflowOpen" Value="true">
                            <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false"/>
                        </Trigger>
                        <Trigger Property="Header" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ToolBarTray.IsLocked" Value="true">
                            <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="HasDropShadow" SourceName="OverflowPopup" Value="true">
                            <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                            <Setter Property="SnapsToDevicePixels" TargetName="Shdw" Value="true"/>
                            <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="Margin" TargetName="Grid" Value="1,3,1,1"/>
                            <Setter Property="Style" TargetName="OverflowButton" Value="{StaticResource ToolBarVerticalOverflowButtonStyle}"/>
                            <Setter Property="Height" TargetName="ToolBarThumb" Value="10"/>
                            <Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/>
                            <Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/>
                            <Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/>
                            <Setter Property="Margin" TargetName="ToolBarHeader" Value="0,0,0,4"/>
                            <Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="1,0,2,2"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top"/>
                            <Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch"/>
                            <Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom"/>
                            <Setter Property="Placement" TargetName="OverflowPopup" Value="Right"/>
                            <Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,11"/>
                            <Setter Property="Background" Value="{StaticResource ToolBarVerticalBackground}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>
